<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <ul id="ul1">
    <li>1<a href="#">删除</a></li>
    <li>2<a href="#">删除</a></li>
    <li>3<a href="#">删除</a></li>
    <li>4<a href="#">删除</a></li>
  </ul>

  <script>
    let a = document.getElementsByTagName("a")
    let ul1 = document.getElementById("ul1")
    for (let i = 0; i < a.length; i++) {
      a[i].onclick = function () {
        ul1.removeChild(this.parentNode)
      }
    }
  </script>

</body>
</html>